USE ConsultTracking
GO
drop proc CreateTaskPreAssignment
drop proc CreateTaskOnSite
drop proc UpdateTask
GO
------------------------------------------------------------------
create proc CreateTaskPreAssignment
@JobID int,
@LocationID int,
@Description nvarchar(100)
as
INSERT INTO [ConsultTracking].[dbo].[Task]
           ([JobID]
           ,[LocationID]
           ,[Description])
     VALUES
           (@JobID
           ,@LocationID
           ,@Description)


----------------------------------------------------------------
go
create proc CreateTaskOnSite
@JobID int,
@LocationID int,
@Description nvarchar(100),
@StartTime smalldatetime,
@EndTime smalldatetime,
@Addressed bit,
@Status nvarchar(100),
@UserID int -- EJR this variable used?

as
INSERT INTO [ConsultTracking].[dbo].[Task]
           ([JobID]
           ,[LocationID]
           ,[Description]
           ,[StartTime]
           ,[EndTime]
           ,[Addressed]
           ,[Status])
     VALUES
           (@JobID
           ,@LocationID
           ,@Description
           ,@StartTime
           ,@EndTime
           ,@Addressed
           ,@Status)
--------------------------------------------------------------
go
create proc UpdateTask
@TaskID int,
@Description nvarchar(100),
@StartTime smalldatetime,
@EndTime smalldatetime,
@Addressed bit,
@Status nvarchar(100)
as
UPDATE [ConsultTracking].[dbo].[Task]
   SET [Description] = @Description
      ,[StartTime] = @StartTime
      ,[EndTime] = @EndTime
      ,[Addressed] = @Addressed
      ,[Status] = @Status
	  ,[Modified] = GETDATE()
 WHERE TaskID = @TaskID